import request from '@/router/axios';
import config from '@/config/website'
import { exportFunc, toQueryString } from '../../export';
//列表
export const salesContractList = (current, size, equipment) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/page',
        method: 'get',
        params: {
            current,
            size,
            ...equipment
        }
    })
}


//新建
export const salesContractAdd = (data) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/save',
        method: 'post',
        data
    })
}
//修改
export const salesContractUpdate = (data) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/update',
        method: 'post',
        data
    })
}
//查看
export const salesContractView = (id) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/detail',
        method: 'get',
        params: {
            id
        }
    })
}

//删除
export const salesContractDel = (ids) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/remove',
        method: 'post',
        params: {
            ids
        }
    })
}

//提交
export const salesContractSubmit = (id) => {
    return request({
        url: '/api/blade-sale/hg_sale/saleContract/start-process',
        method: 'post',
        params: {
            id,
        }
    })
}

//导出
export const salesContractExport = (headers, ids, query) => {
    if (ids != []) {
      var strids = 'ids=' + ids
      exportFunc('/blade-sale/hg_sale/saleContract/ExportExcel', headers, strids, '合同信息.xls')
    }else{
      var str = toQueryString(query)
      exportFunc('/blade-sale/hg_sale/saleContract/ExportExcel', headers, str, '合同信息.xls')
    }
  }